package com.ruoyi.activiti.util;

import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;

import java.io.*;

public class ImageUtils {
    public static void outputSvgAsPng(InputStream svgFileStream, OutputStream os) throws TranscoderException {
        TranscoderInput inputSvgImage = new TranscoderInput(svgFileStream);
        PNGTranscoder converter = new PNGTranscoder();
        TranscoderOutput outputPngImage = new TranscoderOutput(os);
        converter.transcode(inputSvgImage, outputPngImage);
    }
}
